import { defineStore } from 'pinia'
import { store } from '../index'

export interface AppState {
  loginUser: any
}

export const useAppStore = defineStore('app', {
  state: (): AppState => ({
    loginUser: null,
  }),
  getters: {
    getLoginUser(): any {
      return this.loginUser
    }
  },
  actions: {
    setLoginUser(user: any): void {
      this.loginUser = user
    }
  }
})

export function useAppStoreWithOut() {
  return useAppStore(store)
}